<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="robots" content="noindex, nofollow">
    <title>高校健康上报系统</title>
    <link href="/css/login.css" rel="stylesheet"/>
    <link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet"/>
</head>
<body>
<div class="login-content" style="background-image: url(/img/background.svg);">
    <div class="box">

        <div class="box-container">
            <div>
                <p class="application-name" >管理员登录</p>
            </div>
            <div>
                <form id="kc-form-login" class="form" action="/login" method="post">
                    <input type="hidden" id="csrfToken" name="_csrf" th:value="${_csrf.token}" th:if="${_csrf}"/>

                    <label for="username"></label><input id="username" class="login-field" placeholder="用户名" type="text"
                                                         name="username" tabindex="1">
                    <div>
                        <label class="visibility" id="v"><img id="vi" src="/img/eye-off.png" alt="eye"></label>
                    </div>
                    <label for="password"></label><input id="password" class="login-field" placeholder="密码"
                                                         type="password" name="password" tabindex="2">
                    <div id="">
                        <input style="position: relative;" type="checkbox" name="remember"><label>记住我</label>
                    </div>

                    <button class="submit" onclick='doSubmitForm()' type="button" tabindex="3" style="margin-bottom: 10px"
                            id="TencentCaptcha" data-appid="2009136812" data-cbfn="callbackName" data-biz-state="data-biz-state">
                        登录
                    </button>
                    <button class="submit" href="" type="button" style="margin-top:10px " tabindex="3" data-cbfn="callbackName" data-biz-state="data-biz-state">
                        <a style="text-decoration:none" href="/oauth2/dgut">中央认证登录</a>
                    </button>
                </form>
            </div>
        </div>
    </div>

</div>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
<script>
    document.getElementById("v").addEventListener("click", () => {
        const x = document.getElementById("password");
        const v = document.getElementById("vi");
        if (x.type === "password") {
            x.type = "text";
            v.src = "/img/eye.png";
        } else {
            x.type = "password";
            v.src = "/img/eye-off.png";
        }
    });
    window.callbackName = function (res) {
        console.log('callback:', res);
        if (res.ret === 0) {
            var form = document.getElementById('kc-form-login');
            form.submit();
        }
    }
</script>
</body>
</html>
